//
//  UIImage+WBImage.h
//  WeatherBar
//
//  Created by Bert on 2024/6/18.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIImage (WBImage)
+ (UIImage *)wb_originImageWithName:(NSString *)name;

//圆角
- (UIImage *)wb_circleImage;

//按比例取最大图片
+ (UIImage *)wb_cutToBigRect:(UIImage *)image size:(CGSize)size;

//将图片放缩到指定大小
+ (UIImage*)wb_imageResize:(UIImage*)image size:(CGSize)size;
/**
 * 将图片压缩到指定大小
 * 例：想要压缩到32kb---->32*1024B=32678B
 * 最终toByte传32678
 */
+ (UIImage *)wb_compressImage:(UIImage *)image toByte:(NSUInteger)maxLength;
// 颜色转图片
+ (UIImage *)wb_imageWithColor:(UIColor *)imgColor;

// 图片上添加图片
- (UIImage*)wb_addCenterlogo:(UIImage*)centerLogo logoPosition:(CGRect)logoRect;

// 根据图片原始尺寸生成等比例的尺寸大小
- (CGSize)wb_imageSizeByTargetWidth:(CGFloat)targetWidth;
- (CGSize)wb_imageSizeByTargetHeight:(CGFloat)targetHeight;

/** 返回对layer截图的UIImage */
+ (UIImage *)wb_imageWithCapturedLayer:(CALayer *)layer;

// 根据placeholderImage生成指定大小的占位图
+ (UIImage *)wb_makePlaceholderImage:(UIImage *)placeholderImage targetSize:(CGSize)size;

// 通过文字生成图片
+ (UIImage *)wb_imageWithTextStr:(NSString *)string
                         font:(UIFont *)font
                    textColor:(UIColor *)textColor
                        width:(CGFloat)width
                       height:(CGFloat)height
                textAlignment:(NSTextAlignment)textAlignment;
- (UIImage *)wb_croppedImageWithFrame:(CGRect)frame;


+(UIImage *)wb_imageFromText:(NSArray*)arrContent withFont:(CGFloat)fontSize withTextColor:(UIColor *)textColor withBgImage:(UIImage *)bgImage withBgColor:(UIColor *)bgColor;
@end

NS_ASSUME_NONNULL_END
